package com.example.controller;

import com.example.common.Result;
import com.example.entity.TrainingLog;
import com.example.service.TrainingLogsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/trainingLogs")
public class TrainingLogsController {
    @Resource
    private TrainingLogsService trainingLogsService;

    //按时吃药
    @PostMapping("/up")
    public Result upTraining(@RequestBody TrainingLog trainingLog){
        return trainingLogsService.upTraining(trainingLog);
    }
    @PostMapping("/list")
    public Result list(@RequestBody TrainingLog trainingLog){
        return trainingLogsService.list(trainingLog);
    }

    @PostMapping("/list/today")
    public Result listToday(@RequestBody TrainingLog trainingLog){
        return trainingLogsService.listToday(trainingLog);
    }

    @PostMapping("/listAll")
    public Result listAll(){
        return trainingLogsService.listAll();
    }
}
